package com.paitoubing.springboot.dao;

import com.paitoubing.springboot.bean.Users;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UsersMapper {

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into users(username, userpassword) values(#{username}, #{userpassword})")
    public int addUser(Users user);

    @Select("select * from users where id = #{id}")
    public Users findById(Long id);

    //@Select("select * from users")
    public List<Users> findAll();
}
